package sctu.edu.java.year2016.team01.xuhanmei.day20160609.TryUDP;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetSocketAddress;

/**
 * Created by Administrator on 2016/6/9.
 */
public class UDPClient {
    public static void main(String[] args) throws Exception{
        DatagramSocket ds=new DatagramSocket();

        long n=10000L;
        ByteArrayOutputStream baos=new ByteArrayOutputStream();
        DataOutputStream dos=new DataOutputStream(baos);
        dos.writeLong(n);
        byte[] buf= baos.toByteArray();
        DatagramPacket dp=new DatagramPacket(buf,buf.length,new InetSocketAddress("127.0.0.1",5678));

        ds.send(dp);
        ds.close();
    }
}
